<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
	npm i babel-plugin-transform-decorators-legacy --save-dev
	</body>
	<script>
		class Circle {
			draw() {
				console.log('画一个圆形')
			}
		}

		class Decorator {
			constructor(circle) {
				this.circle = circle
			}
			draw() {
				this.circle.draw()
				this.setRedBorder(circle)
			}
			setRedBorder(circle) {
				console.log('设置红色边框')
			}
		}
		//测试代码
		let circle = new Circle();
		circle.draw()

		let dec = new Decorator(circle)
		dec.draw()
	</script>

</html>